<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>07全局阿尔法</title>
		<style type="text/css">
			#firCan {
				display: block;
				border: 1px solid khaki;
				margin: auto;
			}
		</style>
	</head>
	<body>
		<canvas id="firCan" width="1000" height="500">
			您的浏览器版本过低, 不支持Canvas, 请升级!
		</canvas>
	</body>
	<script type="text/javascript">
		// 1, 获取Canvas
		var firCan = document.getElementById("firCan");
		// 2, 获取 2d渲染上下文
		var context = firCan.getContext('2d');
		
		// 3, 绘制矩形
		/*
		 * 全局阿尔法: globalAlpha (alpha 值的基数)
		 * 影响接下来绘制图形的透明度
		 */
		context.globalAlpha = 0.5;
		
		context.fillStyle = 'rgba(255, 0, 0, 1.0)';// 实际透明度 0.5 * 1.0 = 0.5
		context.fillRect(100, 100, 200, 100);
		
		
	</script>
</html>
